/*
 * texture.h
 *
 *  Created on: Apr 24, 2009
 *      Author: HPK
 */

#ifndef TEXTURE_H_
#define TEXTURE_H_

#include <string>

class TextureLoader;

class Texture{
	public:
		typedef enum{ RGB,RGBA } ColorType;


	protected:
		std::string _name;
		unsigned char* _data;
		unsigned int _width;
		unsigned int _height;
		ColorType _ctype;
		TextureLoader* _loader;

	public:
		Texture();
		virtual ~Texture();

		void name(const std::string& name){ _name=name; }
		void data(unsigned char* data){ _data=data; }
		void width(unsigned int width){ _width=width; }
		void height(unsigned int height){ _height=height; }
		void ctype(const ColorType& ctype){ _ctype=ctype; }
		void loader(TextureLoader* loader){ _loader=loader; }

		const std::string& name()const{ return _name; }
		unsigned char* data()const{ return _data; }
		unsigned int width()const{ return _width; }
		unsigned int height()const{ return _height; }
		ColorType ctype()const{ return _ctype; }
		TextureLoader* loader(){ return _loader; }

		void freeData(){
			if(_data)
				delete[] this->_data;
			this->_data=NULL;
		}
};

#endif /* TEXTURE_H_ */
